package cn.hc.sp02.item.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import sp01.pojo.Item;
import sp01.service.ItemService;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 海绵宝宝
 * date 2021/10/29 23:11
 */
@Service
@Slf4j
public class ItemServiceImpl implements ItemService {
    @Override
    public List<Item> getItems(String orderId) {
        List<Item> list = new ArrayList<>();
        list.add(new Item(1,"商品1",23));
        list.add(new Item(2,"商品2",2));
        list.add(new Item(3,"商品3",43));
        list.add(new Item(4,"商品4",24));
        list.add(new Item(5,"商品5",14));
        list.add(new Item(6,"商品6",9));
        System.out.println(1/0);
        return list;
    }

    @Override
    public void decreaseNumber(List<Item> items) {
        for (Item item : items) {
            log.info("减少商品库存："+item);
        }
    }
}
